﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace CSCodeLib.Utility
{
    public static class Singleton
    {
        //public static T GetInstance<T>(string classname)
        //{
        //    return GetInstance<T>(classname, null);
        //}

        //public static T GetInstance<T>(string classname, string key)
        //{
        //    if (HttpContext.Current == null)
        //    {
        //        return System.Reflection.CreateClass<T>(classname);
        //    }

        //    if (key == null)
        //    {
        //        key = HttpContext.Current.GetHashCode().ToString("x") + ":" + classname;
        //    }

        //    T ret = (T)HttpContext.Current.Items[key];
        //    if (ret == null)
        //    {
        //        ret = System.Reflection.CreateClass<T>(classname);
        //        HttpContext.Current.Items[key] = ret;
        //    }

        //    return ret;
        //}
    }
}
